#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int arr[N];
int n, m;
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	int x;
	while (m--) {
		cin >> x;
		int l = 0;
		int r = n + 1;
		while (l + 1 != r) {
			int mid = (l + r) / 2;
			if (arr[mid] <= x) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
		cout << l << endl;
	}
	return 0;
}